ComboBox: Use iter before popdown() may invalidate
authorDaniel Boles <dboles@src.gnome.org>
Fri, 25 Aug 2017 20:00:51 +0000 (21:00 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Fri, 25 Aug 2017 20:00:51 +0000 (21:00 +0100)
commit696b9a5df7fc89bf007a11c7f8b6a6a913229feb
tree48b7e22bfe5f9f08578446c211bdc220d1bb22b3
parent32553ad3a2068be6d099d9a045c0403b799c2700
ComboBox: Use iter before popdown() may invalidate

Bad actors, such as our very own FileChooserButton, may connect to the
:popped-up property and alter the model as the menu becomes in/visible.

We were getting an iter to the model while popped-up, then doing
popdown(), then using the iter, which may have just been invalidated by
the errant notify::popped-up handler. If so, we quickly crash fatally.

This is clearly bonkers, but until such patterns are removed, we have to
work around them. So, set_active() from the clicked item while it is
known to be valid, by moving the call to set_active() before popdown().

While here, change set_active_iter(iter) to set_active_internal(path) to
avoid pointlessly going through the iter to get the path we already have

https://bugzilla.gnome.org/show_bug.cgi?id=729651
gtk/gtkcombobox.c